package twentyThreePattern.create5.simple_factory.section5;

import java.lang.reflect.Constructor;

public class SingletonFactory {
	
	private static Singleton singleton;
	
	
	static {
		
		try {
			Class<?> clazz = Class.forName(Singleton.class.getName());
			Constructor<?> constructor = clazz.getDeclaredConstructor();
			constructor.setAccessible(Boolean.TRUE);
			@SuppressWarnings("unused")
			Singleton singleton = (Singleton) constructor.newInstance();
			
		} catch (Exception e) {
			
		}
	}
	
	public static Singleton getInstance(){
		return singleton;
	}

}
